from bilibliwebutils import *
import requests
import time

single_data_path = "./data_single/"

def single_thread():
    for api in B_RANK_APIS:
        # print("《《"*10 + api + "》》》"*10 )
        url = B_RANK_URL + api
        resp = requests.get(url)
        ranks = parse_rank_html(resp.text, True)
        file_path = single_data_path + api + ".txt"
        write_local_data(ranks, file_path)

if __name__ == "__main__":
    create_floder(single_data_path)
    start = time.time()
    single_thread()
    end = time.time()
    print("\n 》》》single thread cost:" + str(end - start) + " seconds")
